{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/App.tsx\",\n  _s = $RefreshSig$();\nimport React from 'react';\nimport Title from \"./utils/Title\";\nimport { Context } from \"./index\";\nimport { observer } from \"mobx-react-lite\";\nimport { Route, Routes, useNavigate } from \"react-router-dom\";\nimport { Auth, Im, Profile, Contacts } from \"./pages\";\nimport { browserRouteAuth, browserRouteContacts, browserRouteIm, browserRouteProfile } from \"./routes\";\nimport { Modal } from \"./components\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nimport { Fragment as _Fragment } from \"react/jsx-dev-runtime\";\nconst App = () => {\n  _s();\n  const {\n    store\n  } = React.useContext(Context);\n  const navigate = useNavigate();\n  const [showModal, setShowModal] = React.useState(false);\n  Title();\n  React.useEffect(() => {\n    if (localStorage.getItem(`${process.env.REACT_APP_NAME_TOKEN}`)) {\n      store.checkAuth();\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n  React.useEffect(() => {\n    store.getAuth() ? navigate(browserRouteIm) : navigate(browserRouteAuth);\n    if (store.getAuth()) {\n      store.getContactsFromAPI();\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [store.getAuth()]);\n  React.useEffect(() => {\n    if (store.getProfile() && !store.getProfile().verified) {\n      setShowModal(true);\n      navigate(browserRouteAuth);\n      console.log(232);\n    } else {\n      setShowModal(false);\n    }\n  }, [store.getProfile()]);\n  if (store.getLoading()) {\n    return /*#__PURE__*/_jsxDEV(\"section\", {\n      className: \"global_loading\",\n      children: /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"loading\"\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 46,\n        columnNumber: 17\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 45,\n      columnNumber: 13\n    }, this);\n  }\n  return /*#__PURE__*/_jsxDEV(_Fragment, {\n    children: [/*#__PURE__*/_jsxDEV(Modal, {\n      active: showModal,\n      title: \"Пользователь не верифицирован!\",\n      hasFunctionButtons: true,\n      children: /*#__PURE__*/_jsxDEV(\"div\", {\n        children: \"\\u0412\\u0430\\u043C \\u043D\\u0435\\u043E\\u0431\\u0445\\u043E\\u0434\\u0438\\u043C\\u043E \\u043F\\u0440\\u043E\\u0439\\u0442\\u0438 \\u0432\\u0435\\u0440\\u0438\\u0444\\u0438\\u043A\\u0430\\u0446\\u0438\\u044E \\u043F\\u043E \\u043F\\u043E\\u0447\\u0442\\u0435, \\u0447\\u0442\\u043E\\u0431\\u044B \\u0438\\u0441\\u043F\\u043E\\u043B\\u044C\\u0437\\u043E\\u0432\\u0430\\u0442\\u044C \\u0444\\u0443\\u043D\\u043A\\u0446\\u0438\\u043E\\u043D\\u0430\\u043B \\u043F\\u0440\\u0438\\u043B\\u043E\\u0436\\u0435\\u043D\\u0438\\u044F.\"\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 58,\n        columnNumber: 17\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 53,\n      columnNumber: 13\n    }, this), /*#__PURE__*/_jsxDEV(Routes, {\n      children: [/*#__PURE__*/_jsxDEV(Route, {\n        path: browserRouteAuth,\n        element: /*#__PURE__*/_jsxDEV(Auth, {}, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 61,\n          columnNumber: 57\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 61,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Route, {\n        path: browserRouteIm,\n        element: /*#__PURE__*/_jsxDEV(Im, {}, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 62,\n          columnNumber: 55\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 62,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Route, {\n        path: browserRouteProfile,\n        element: /*#__PURE__*/_jsxDEV(Profile, {}, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 63,\n          columnNumber: 60\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 63,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Route, {\n        path: browserRouteContacts,\n        element: /*#__PURE__*/_jsxDEV(Contacts, {}, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 64,\n          columnNumber: 61\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 64,\n        columnNumber: 17\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 60,\n      columnNumber: 13\n    }, this)]\n  }, void 0, true);\n};\n_s(App, \"lvB6hMaQ4Kkr4irp42ocAWCDlnI=\", false, function () {\n  return [useNavigate];\n});\n_c = App;\nexport default _c2 = observer(App);\nvar _c, _c2;\n$RefreshReg$(_c, \"App\");\n$RefreshReg$(_c2, \"%default%\");","map":{"version":3,"names":["React","Title","Context","observer","Route","Routes","useNavigate","Auth","Im","Profile","Contacts","browserRouteAuth","browserRouteContacts","browserRouteIm","browserRouteProfile","Modal","App","store","useContext","navigate","showModal","setShowModal","useState","useEffect","localStorage","getItem","process","env","REACT_APP_NAME_TOKEN","checkAuth","getAuth","getContactsFromAPI","getProfile","verified","console","log","getLoading"],"sources":["/data/messenger.client/src/App.tsx"],"sourcesContent":["import React, {FC} from 'react';\nimport Title from \"./utils/Title\";\nimport {Context} from \"./index\";\nimport {observer} from \"mobx-react-lite\";\nimport {Route, Routes, useNavigate} from \"react-router-dom\";\nimport {Auth, Im, Profile, Contacts} from \"./pages\";\nimport {browserRouteAuth, browserRouteContacts, browserRouteIm, browserRouteProfile} from \"./routes\";\nimport {Modal} from \"./components\";\n\nconst App: FC = () => {\n    const {store} = React.useContext(Context);\n    const navigate = useNavigate();\n    const [showModal, setShowModal] = React.useState<boolean>(false);\n\n    Title();\n\n    React.useEffect( () => {\n        if (localStorage.getItem(`${process.env.REACT_APP_NAME_TOKEN}`)) {\n            store.checkAuth();\n        }\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, []);\n\n    React.useEffect( () => {\n        (store.getAuth())? navigate(browserRouteIm): navigate(browserRouteAuth);\n\n        if (store.getAuth()) {\n            store.getContactsFromAPI();\n        }\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, [store.getAuth()]);\n\n    React.useEffect(() => {\n        if (store.getProfile() && !store.getProfile().verified) {\n            setShowModal(true);\n            navigate(browserRouteAuth);\n            console.log(232);\n        } else {\n            setShowModal(false);\n        }\n    }, [store.getProfile()]);\n\n    if (store.getLoading()) {\n        return (\n            <section className='global_loading'>\n                <div className=\"loading\"></div>\n            </section>\n        )\n    }\n\n    return (\n        <>\n            <Modal\n                active={showModal}\n                title={\"Пользователь не верифицирован!\"}\n                hasFunctionButtons={true}\n            >\n                <div>Вам необходимо пройти верификацию по почте, чтобы использовать функционал приложения.</div>\n            </Modal>\n            <Routes>\n                <Route path={browserRouteAuth} element={<Auth/>} />\n                <Route path={browserRouteIm} element={<Im/>} />\n                <Route path={browserRouteProfile} element={<Profile/>} />\n                <Route path={browserRouteContacts} element={<Contacts/>} />\n            </Routes>\n        </>\n    );\n}\n\nexport default observer(App);\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAY,OAAO;AAC/B,OAAOC,KAAK,MAAM,eAAe;AACjC,SAAQC,OAAO,QAAO,SAAS;AAC/B,SAAQC,QAAQ,QAAO,iBAAiB;AACxC,SAAQC,KAAK,EAAEC,MAAM,EAAEC,WAAW,QAAO,kBAAkB;AAC3D,SAAQC,IAAI,EAAEC,EAAE,EAAEC,OAAO,EAAEC,QAAQ,QAAO,SAAS;AACnD,SAAQC,gBAAgB,EAAEC,oBAAoB,EAAEC,cAAc,EAAEC,mBAAmB,QAAO,UAAU;AACpG,SAAQC,KAAK,QAAO,cAAc;AAAC;AAAA;AAEnC,MAAMC,GAAO,GAAG,MAAM;EAAA;EAClB,MAAM;IAACC;EAAK,CAAC,GAAGjB,KAAK,CAACkB,UAAU,CAAChB,OAAO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